package com.hz.sdka;

import android.app.Application;

import com.facebook.CustomTabMainActivity;
import com.facebook.FacebookActivity;
import com.facebook.ads.AudienceNetworkActivity;
import com.google.android.gms.ads.AdActivity;
import com.google.android.gms.common.api.GoogleApiActivity;
import com.hz.sdka.commona.utils.LogUtils;
import com.hz.sdka.sdka.AdInitializea;

import java.util.ArrayList;
import java.util.List;

public class AdSDKa {

    private static AdInitializea initialize;

    private static final AdSDKa hzAdSdk = new AdSDKa();

    private AdSDKa() {
        if (initialize == null) {
            initialize = new AdInitializea();
        }
    }

    public static AdSDKa getInstance() {
        return hzAdSdk;
    }

    public void init(Application application, String appid, String appkey, String adJustKey) {
        init(application, appid, appkey, "default", adJustKey);
    }


    public void init(Application application, String appid, String appkey, String umChannel, String adJustKey) {
        try {
            if (initialize != null) {
                initialize.init(application, appid, appkey, umChannel, adJustKey);
            }
        } catch (Throwable throwable) {
            LogUtils.e(throwable.getMessage());
        }
    }

    public void setDebug(boolean debug) {
        if (initialize != null)
            initialize.setDebug(debug);
    }

    /**
     * 判断是否为自然量用户
     *
     * @return true 自然量 不弹应用外 默认为自然用户
     */
    public boolean isOrganic() {
        if (initialize != null)
            return initialize.isOrganic();
        return true;
    }

    /*获取所有广告对应的activity*/
    public List<Class> getAdActivity() {
        List<Class> list = new ArrayList<>();
        list.add(AdActivity.class);
        list.add(FacebookActivity.class);
        list.add(CustomTabMainActivity.class);
        list.add(AudienceNetworkActivity.class);
        list.add(GoogleApiActivity.class);
        return list;
    }

}
